package com.whj.servicedriveruser.service.impl;

import com.whj.internalcommon.dto.ResponseResult;
import com.whj.servicedriveruser.mapper.DriverUserMapper;
import com.whj.servicedriveruser.service.CityDriverUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: wanghaijun
 * @Date: 2023/2/18 - 02 - 18 - 14:44 
 * @Description: com.whj.servicedriveruser.service.impl
 */

@Service
public class CityDriverUserServiceImpl implements CityDriverUserService {

    @Autowired
    private DriverUserMapper driverUserMapper;

    /**
     * 查询该城市是否对应有司机有返回true
     *
     * @param cityCode 城市编码
     * @return
     */
    public ResponseResult<Boolean> isAvailableDriver(String cityCode) {
        Integer integer = driverUserMapper.selectDriverUserCountByCityCode(cityCode);
        if (integer > 0) {
            return ResponseResult.success(true);
        } else {
            return ResponseResult.success(false);
        }
    }
}
